package com.stox.client.ui.javafx.widget;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.scene.Node;
import javafx.scene.control.Skin;
import javafx.scene.control.TextField;

import com.stox.client.ui.javafx.widget.skin.CustomTextFieldSkin;

public class CustomTextField extends TextField {


	public CustomTextField() {
        getStyleClass().add("custom-text-field"); //$NON-NLS-1$
    }

    private ObjectProperty<Node> left = new SimpleObjectProperty<Node>(this, "left"); //$NON-NLS-1$
    
    public final ObjectProperty<Node> leftProperty() {
        return left;
    }
    
    public final Node getLeft() {
        return left.get();
    }
    
    public final void setLeft(Node value) {
        left.set(value);
    }
    
    
    private ObjectProperty<Node> right = new SimpleObjectProperty<Node>(this, "right"); //$NON-NLS-1$
    
    public final ObjectProperty<Node> rightProperty() {
        return right;
    }
    
    public final Node getRight() {
        return right.get();
    }
    
    public final void setRight(Node value) {
        right.set(value);
    }
    
    @Override protected Skin<?> createDefaultSkin() {
        return new CustomTextFieldSkin(this) {
            @Override public ObjectProperty<Node> leftProperty() {
                return CustomTextField.this.leftProperty();
            }
            
            @Override public ObjectProperty<Node> rightProperty() {
                return CustomTextField.this.rightProperty();
            }
        };
    }
    
    @Override protected String getUserAgentStylesheet() {
        return CustomTextField.class.getClassLoader().getResource("style/customtextfield.css").toExternalForm(); //$NON-NLS-1$
    }
}

